package com.sleepcamel.resteasyConfigurator.model.command;

import com.sleepcamel.rest.domain.ProjectRootItem;
import com.sleepcamel.rest.domain.TreeNode;

public class DeleteTreeNodeCommand extends BaseCommand<TreeNode> {

	@Override
	public void execute() {
		if ( receiver != null && receiver instanceof TreeNode){
			TreeNode entity = (TreeNode) receiver;
			TreeNode parent = entity.getParent();
			if ( parent != null && ! (parent instanceof ProjectRootItem) ){
				parent.removeChild(entity);
			}
		}
	}

}
